<?php
/**
 * Created by PhpStorm.
 * User: yy
 * Date: 2017/1/24
 * Time: 17:31
 */

namespace EWeiLink\JuPai;


trait RequestTrait
{
    public function getRule()
    {
        $preg = '/(?<=\/)[a-zA-Z]+$/';
        preg_match($preg, request()->url(), $match);
        $controller_name = $match[0];
        if (method_exists($this, $controller_name)) {
            return $this->$controller_name();
        }
    }
}